#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>

int 
main(int argc ,char **argv)
{
    char buf[4096];

    int fd;
    struct sockaddr_in sin;
    int bytes = 0;


    char *msg = "he is qihoo qihu 立夏 春夏秋冬qihoo360\n";
    

    bzero(&sin,sizeof(sin));
    sin.sin_family = AF_INET;
    sin.sin_port = htons(9457);
    sin.sin_addr.s_addr = inet_addr("10.16.15.124");

    if((fd=socket(AF_INET,SOCK_STREAM,0)) == -1 ) {
        perror("EROOR socket");
        return -1;
    }

    if(connect(fd,(struct sockaddr*)(&sin),sizeof(struct sockaddr)) == -1) {
        perror("ERROR connect");
        return -1;
    }

    if(send(fd,msg,strlen(msg),0) < 0) {
        perror("ERROR send");
        close(fd);
        return -1;
    }

    if((bytes = recv(fd,buf,4096,0)) == -1) {
        perror("ERROR recv");
        close(fd);
        return -1;
    }

    buf[bytes] = '\0';

    fprintf(stdout,"recv :%s\n",buf);
    close(fd);
    return 1;
}
